
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%--<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/functions" %>--%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Vestibule  by FCT</title>
  <link href="http://fonts.googleapis.com/css?family=Oxygen:400,700,300" rel="stylesheet" type="text/css" />
  <link href="style.css" rel="stylesheet" type="text/css" media="screen" />

  <c:set var="pagination" value="${paginator}" />
  <c:set var="iterator" value="0" />
  <c:set var="currentBookAmountPerPage" value="${fn:length(books)}" />
  <c:set var="dataTableColumns" value="3" />
  <c:set var="tempDataTableRows" value="${currentBookAmountPerPage/dataTableColumns}" />
  <c:set var="dataTableRows" value="${tempDataTableRows + (1 - (tempDataTableRows % 1)) % 1}" />
  <%--<c:set var="defaultColumnsAmount" value="3"></c:set>--%>
  <%--<c:set var="defaultRowsAmount" value="1"></c:set>--%>

  <%--<c:set var="defaultColumnsAmount" value="3" />--%>
  <%--<c:set var="defaultRowsAmount" value="1" />--%>

  <%--<c:if test="${not empty bookAmountPerPage}">--%>
    <%--<c:set var="columnsAmount" value="${defaultColumns}"></c:set>--%>
    <%--<c:set var="rowsAmount" value="${currentBookAmountPerPage / defaultColumnsAmount + 0.5}"></c:set>--%>
  <%--</c:if>--%>
  <%--<c:set var="bookIsbn" value="${book.ISBN}" scope="page" />--%>
</head>
<body>

  <div id="wrapper">
  <div id="menu-wrapper">
    <div id="menu" class="container">
      <ul>
        <li class="current_page_item"><a href="#">Homepage</a></li>
        <li><a href="#">Services</a></li>
        <li><a href="#">Blog</a></li>
        <li><a href="#">Photos</a></li>
        <li><a href="#">About Us</a></li>
        <li><a href="#">Links</a></li>
        <li><a href="#">Contact Us</a></li>
      </ul>
    </div>
  </div>
  <div id="logo" class="container">
    <h1><a href="#">Vestibule</a></h1>
    <p>In posuere eleifend odio quisque semper augue.</p>
  </div>
  <div id="page" class="container">
    <div>
      <div class="entry">
        <p>This is <strong>Vestibule </strong>, a free, fully standards-compliant CSS template designed by <a href="http://www.freecsstemplates.org">FCT</a>.     The photos in this template are from <a href="http://fotogrph.com/"> Fotogrph</a>. This free template is released under a <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attributions 3.0</a> license, so you are pretty much free to do whatever you want with it (even use it commercially) provided you keep the links in the footer intact. Aside from that, have fun with it :) </p>
      </div>
    </div>
  </div></div>
  <div class="container">
    <c:forEach begin="1" end="${dataTableRows}" varStatus="currentRow">
      <!----rows--->
      <div class="content-box">
        <c:if test="${(currentRow.count * dataTableColumns) le currentBookAmountPerPage}">
          <c:forEach begin="1" end="${dataTableColumns}">
            <!-- columns-------------->
            <div class="tbox">
              <div class="box-style box-style">
                <div class="content">
                  <%--<div class="image"><img src="images/img01.jpg" width="324" height="200" alt="" /></div>--%>
                  <div class="image"><img src="<c:out value="image?isbn=${books[iterator].ISBN}" />" /></div>

                  <h2>Fusce ultrices fringilla</h2>
                  <p>Aliquam erat volutpat. Pellentesque tristique ante ut risus. Quisque dictum. Integer nisl risus, sagittis convallis, rutrum id, elementum congue, nibh. </p>
                    <a href="<c:out value="book?isbn=${books[iterator].ISBN}" />" class="button">Learn More</a>
                </div>
              </div>
            </div>
            <!---end columns------------->
            <c:set var="iterator" value="${iterator + 1}"></c:set>
          </c:forEach>
        </c:if>
        <c:if test="${(currentRow.count * dataTableColumns) gt currentBookAmountPerPage}">
          <c:forEach begin="1" end="${dataTableColumns - (currentRow.count * dataTableColumns - currentBookAmountPerPage)}">
            <!-- columns-------------->
            <div class="tbox">
              <div class="box-style box-style">
                <div class="content">
                  <%--<div class="image"><img src="images/img01.jpg" width="324" height="200" alt="" /></div>--%>
                  <div class="image"><img src="image?isbn=${books[iterator].ISBN}" /></div>
                  <h2>Fusce ultrices fringilla</h2>
                  <p>Aliquam erat volutpat. Pellentesque tristique ante ut risus. Quisque dictum. Integer nisl risus, sagittis convallis, rutrum id, elementum congue, nibh. </p>
                  <a href="book?isbn=${books[iterator].ISBN}" class="button">Learn More</a>
                </div>
              </div>
            </div>
            <!---end columns------------->
            <c:set var="iterator" value="${iterator + 1}"></c:set>
          </c:forEach>
        </c:if>
      </div>
    </c:forEach>
  </div>





    <div>
    <c:if test="${pagination.previousPage != 0}">
      <a href="lookupbooks?pageNumber=<c:out value="${pagination.previousPage}" />">previous</a>
    </c:if>
    <c:if test="${pagination.firstPage != 0}">
      <a href="lookupbooks?pageNumber=<c:out value="${pagination.firstPage}" />"><c:out value="${pagination.firstPage}" /></a>
      ...
    </c:if>
    <c:forEach var="pagenumber" items="${pagination.pageNumbers}">
      <a href="lookupbooks?pageNumber=<c:out value="${pagenumber}"></c:out>"><c:out value="${pagenumber}"></c:out></a>
    </c:forEach>
    <c:if test="${pagination.lastPage != 0}">
      ...
      <a href="lookupbooks?pageNumber=<c:out value="${pagination.lastPage}" />"><c:out value="${pagination.lastPage}" /></a>
    </c:if>
    <c:if test="${pagination.nextPage != 0}">
      <a href="lookupbooks?pageNumber=<c:out value="${pagination.nextPage}" />">next</a>
    </c:if>
    </div>

<div id="footer">
  <p>© 2013 Untitled Inc. All rights reserved. Lorem ipsum dolor sit amet nullam blandit consequat phasellus etiam lorem. Design by <a href="http://www.freecsstemplates.org">FCT</a>.  Photos by <a href="http://fotogrph.com/">Fotogrph</a>.</p>
</div>
<!-- end #footer -->
</body>

</html>